<!-- 质量扣留历史记录 -->

<script setup>
import { ref, inject, reactive } from 'vue'
import { ElMessageBox } from 'element-plus'
//引入axios
const axios = inject('axios')

//数据
const testdata = reactive({
  "orderDetainRecords": []
})

//发送请求时的附带数据
const Data = reactive({
  "conditions": { "orderNoOrProductionNo": "", "startDate": "", "endDate": "" }
})

//获取所有数据
function selectData() {
  axios({
    method: 'post',
    url: '/api/orderDetainRecords/selectAll',
    // data: Data
  }).then((response) => {
    if (response.data.success) {
      if (response.data.map.orderDetainRecords != null) {
        testdata.orderDetainRecords = response.data.map.orderDetainRecords
      } else {
        ElMessageBox.alert("无信息！", '结果')
      }
    } else {
      ElMessageBox.alert(response.data.msg, '结果')
    }
  }).catch((error) => {
    ElMessageBox.alert("系统错误！", '结果')
  })
}
selectData()

//按条件获取数据
function selectData1() {
  axios({
    method: 'post',
    url: '/api/orderDetainRecords/select1',
    data: Data.conditions
  }).then((response) => {
    if (response.data.success) {
      if (response.data.map.orderDetainRecords != null) {
        testdata.orderDetainRecords = response.data.map.orderDetainRecords
      } else {
        ElMessageBox.alert("无信息！", '结果')
      }
    } else {
      ElMessageBox.alert(response.data.msg, '结果')
    }
  }).catch((error) => {
    ElMessageBox.alert("系统错误！", '结果')
  })
}
//表单序号自增
const indexMethod = (index) => {
  return index + 1
}

</script>

<template>
  <el-row style="background-color:white;margin:20px 10px 0 10px">
    <el-col :span="5" style="margin:10px 0 0 10px">
      <el-date-picker v-model="Data.conditions.startDate" type="date" placeholder="处理时间" />
    </el-col>
    <el-col :span="5" style="margin-top:10px">
      <el-date-picker v-model="Data.conditions.endDate" type="date" placeholder="处理时间" />
    </el-col>
    <el-col :span="11" style="margin-top:10px;">
      <el-input v-model="Data.conditions.orderNoOrProductionNo" placeholder="请输入订单编号或生产序号" />
    </el-col>
    <el-col :span="2" style="margin-top:10px">
      <el-button type="success" @click="selectData1">查询</el-button>
    </el-col>
  </el-row>
  <el-row style="background-color:white;margin:0 10px 0 10px">
    <el-col :span="24" style="margin-top:15px">
      <!--:data为测试数据，可对应数据库修改  stripe斑马纹效果 border带边框 -->
      <el-table :data="testdata.orderDetainRecords" stripe border style="width:100%">
        <!-- 定义列表属性 prop值可对于数据库字段名修改-->
        <el-table-column label="序号" align="center" type="index" :index="indexMethod" width="50"></el-table-column>
        <el-table-column label="订单编号" align="center" prop="orderNo" width="110" />
        <el-table-column label="生产序号" align="center" prop="productionNo" width="110" />
        <el-table-column label="产品型号" align="center" prop="productModel" width="400" />
        <el-table-column label="产品货号" align="center" prop="productNo" width="120" />
        <el-table-column label="处理物料" align="center" prop="handleMaterial" width="100" />
        <el-table-column label="处理数量" align="center" prop="handleQuantity" width="60" />
        <el-table-column label="申请工位" align="center" prop="applyStation" width="90" />
        <el-table-column label="申请人员" align="center" prop="applier" width="90" />
        <el-table-column label="处理人员" align="center" prop="handler" width="90" />
        <el-table-column label="处理时间" align="center" prop="handleTime" width="110" />
        <el-table-column label="处理方式" align="center" prop="handleWay" width="100" />
        <el-table-column label="处理原因" align="center" prop="handleReason" width="150" />
        <el-table-column label="处理图片" align="center" prop="handlePhoto" width="150" />
      </el-table>
    </el-col>
  </el-row>
</template>

<style scoped>

</style>